xenconsoled: Fix rate-limit calculation overflow leading to console freezes.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 23 Jun 2009 10:25:38 +0000 (11:25 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 23 Jun 2009 10:25:38 +0000 (11:25 +0100)
From: Eric Tessler <eric@3tera.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/console/daemon/io.c

index 2475963a5819931e2917d985811f38ee76b48174..11e0950595953a221e04e25c1606d4c0b0f10b3e 100644 (file)
@@ -688,7 +688,7 @@ static struct domain *create_domain(int domid)
        dom->buffer.capacity = 0;
        dom->buffer.max_capacity = 0;
        dom->event_count = 0;
-       dom->next_period = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) + RATE_LIMIT_PERIOD;
+       dom->next_period = ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) + RATE_LIMIT_PERIOD;
        dom->next = NULL;
 
        dom->ring_ref = -1;
@@ -1009,7 +1009,7 @@ void handle_io(void)
 
                if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
                        return;
-               now = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000);
+               now = ((long long)ts.tv_sec * 1000) + (ts.tv_nsec / 1000000);
 
                /* Re-calculate any event counter allowances & unblock
                   domains with new allowance */